<template>
    <div class="item">
        <a @click="scrollto(index)" v-for="(item, index) in   list  " :class="ipoNavActive == index ? 'active' : ''"
            :key="index">{{
                item }}</a>
    </div>
</template>

<script lang="ts">
export default {
    name: "IpoNav",
};
</script>

<script lang="ts" setup>
import { ref, defineProps, computed, defineExpose } from "vue"
import i18n from '@/locales'
import { getCurrentInstance } from 'vue'
const { proxy } = (getCurrentInstance() as any)
const props = defineProps<{ scroll: Function }>()
const ipoNavActive = ref(0)
const scrollto = (index: number) => {
    const ref11 = "i" + index + "TOP"
    //  console.log(ref11)
    ipoNavActive.value = index
    props.scroll(ref11)
}
defineExpose({
    ipoNavActive
})
const list = computed(() => ([proxy.$t('ipo.CompanyInformation'), proxy.$t('ipo.TypeofListing.TypeofListing'), proxy.$t('ipo.Offering.Offering'), proxy.$t('ipo.advisers.Adviser'), proxy.$t('ipo.Timetable.Timetable'), proxy.$t('ipo.Documents.Documents'), proxy.$t('ipo.TransactionCosts.TransactionCosts')]))
</script>

<style lang="scss" scoped>
.item {
    margin-top: 18px;
    display: flex;

    @media screen and (max-width: 768px) {
        margin-top: 0px;
       // width: 100vw;
        overflow-x: scroll;
        margin-left: 15px;
    }

    a {
        // margin-left: 5px;
        padding: 5px 10px;
        font-size: 20px;
        color: #738B9B;
        font-weight: 700;
        border-radius: 30px;
        text-decoration: none;
        width: fit-content;
        white-space: nowrap;

        &:hover {
            // background-color: #1C3F56;
            // color: #fff;
            cursor: pointer;
        }

        &.active {
            background-color: #1C3F56;
            color: #fff;
        }
    }
}
</style>